]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
mountOperation: Close when drive gets disconnected
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 4 Jan 2024 13:39:45 +0000 (14:39 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Jan 2024 15:08:14 +0000 (15:08 +0000)
If the volume that corresponds to the mount operation has an
associated drive, we should withdraw any pending dialogs or
notifications when the drive gets physically disconnected,
as they've become obsolete.

Close https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7302

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3089>

js/ui/shellMountOperation.js

index 84f8ad63144c118f5c5886fbb7d233513f7f892e..caef313af276db17e623fbf846107ffc41ef2ba4 100644 (file)
@@ -74,6 +74,10 @@ export class ShellMountOperation {
             this.close.bind(this));
         this.mountOp.connect('show-unmount-progress',
             this._onShowUnmountProgress.bind(this));
+
+        this._drive = source.get_drive();
+        this._drive?.connectObject('disconnected',
+            this.close.bind(this), this);
     }
 
     _closeExistingDialog() {
@@ -141,6 +145,11 @@ export class ShellMountOperation {
             this._notifier.done();
             this._notifier = null;
         }
+
+        if (this._drive) {
+            this._drive.disconnectObject(this);
+            this._drive = null;
+        }
     }
 
     _onShowProcesses2(op) {